import urllib
import re

data = urllib.urlopen("http://twitter.com/login").readlines()
print data
pattern = """<input name="authenticity_token" value="(.+?)" type="hidden">"""
match = re.compile(pattern)
token = match.findall(str(data))
print token

username = "session[username_or_email]"
password = "session[password]"

